<!--
 * @Description: 公司质量参数
 * @Autor: wangwangwang
 * @Date: 2021-03-23 13:52:29
 * @LastEditors: wangwangwang
 * @LastEditTime: 2021-04-29 11:57:13
-->
<template>
  <div>
    <div style="text-align: right;padding: 20px 20px 0 20px;position: relative;">
      <span style="position: absolute;left: 20px;top: 20px;">
        <!-- <span style="margin-right: 24px;">公司</span>
        <el-select v-model="companyId" placeholder="请选择">
          <el-option v-for="(item, index) in companylist" :key="index" :label="item.name" :value="item.id"></el-option>
        </el-select> -->
      </span>
      <el-button size="small" class="bottom_all" @click="saveSet()">保存</el-button>
    </div>
    <div class="info">
      <div class="items">
        <div class="item">
          <div class="item-title">检测类别</div>
          <div class="item1">
            <div :class="dataType==1?'active':''" @click="change1(1)">原物料</div>
            <div :class="dataType==2?'active':''" @click="change1(2)">混凝土</div>
          </div>
          <div class="link_bg">
            <el-link :underline="false" class="table_link" @click="addtext(1)">
              <i class="icon iconfont iconicon_button_add" style="font-size: 12px;"></i>
              添加
            </el-link>
          </div>
          <div class="radio">
            <el-radio-group v-model="showtestTypeId" @change="changetestTypeId">
              <template v-for="(item, index) in table.types">
                <div :key="index" class="radio-bg">
                  <el-radio :label="item.id">
                    <span>{{ item.name }}</span>
                  </el-radio>
                  <span class="block">
                    <i class="icon iconfont iconicon_error" style="font-size: 12px;" @click.stop="deletetext(item)"></i>
                  </span>
                </div>
              </template>
            </el-radio-group>
          </div>
        </div>
        <div class="item-hr"></div>
        <div class="item">
          <div class="item-title">检验项目</div>
          <div class="link_bg">
            <el-link :underline="false" class="table_link" @click="handleAdd()">
              <i class="icon iconfont iconicon_button_add" style="font-size: 12px;"></i>
              添加
            </el-link>
          </div>
          <div style="padding:0 20px">
            <el-input v-model="input" placeholder="请输入内容"></el-input>
          </div>
          <div class="radio">
            <el-radio-group v-model="showitemsId" @change="changeitemsId">
              <template v-for="(item, index) in table.item">
                <div :key="index" class="radio-bg">
                  <el-radio :label="item.id">{{ item.name }}</el-radio>
                  <span class="block">
                    <i class="icon iconfont iconicon_button_modification" style="font-size: 12px;" @click.stop="handleEdit(item)"></i>
                    <i v-if="item.deleteStatus!=2" class="icon iconfont iconicon_error" style="font-size: 12px;" @click.stop="deletetext(item)"></i>
                  </span>
                </div>
              </template>
            </el-radio-group>
          </div>
        </div>
        <div class="item-hr"></div>
        <div class="item">
          <div class="item-title">检验要求</div>
          <div class="link_bg">
            <el-link :underline="false" class="table_link" @click="addtext(3)">
              <i class="icon iconfont iconicon_button_add" style="font-size: 12px;"></i>
              添加
            </el-link>
          </div>
          <div class="radio">
            <el-radio-group v-model="showclaimId" @change="changeclaimId">
              <template v-for="(item, index) in table.require">
                <div :key="index" class="radio-bg">
                  <el-radio :label="item.id">{{ item.name }}</el-radio>
                  <span class="block">
                    <i v-if="item.deleteStatus!=2" class="icon iconfont iconicon_error" style="font-size: 12px;" @click.stop="deletetext(item)"></i>
                  </span>
                </div>
              </template>
            </el-radio-group>
          </div>
        </div>
        <div class="item-hr"></div>
        <div class="item">
          <div class="item-title">操作类型</div>
          <div style="padding:10px 20px">
            <el-checkbox v-model="isStrictly">是否严控 ？</el-checkbox>
          </div>
          <div class="radio">
            <el-radio-group v-model="showtype" @change="changetype">
              <div class="radio-bg">
                <el-radio :label="1">下拉框</el-radio>
              </div>
              <div class="radio-bg">
                <el-radio :label="2">文本框</el-radio>
              </div>
              <div class="radio-bg">
                <el-radio :label="3">数值</el-radio>
              </div>
              <div class="radio-bg">
                <el-radio :label="4">无绑定</el-radio>
              </div>
            </el-radio-group>
          </div>
        </div>
        <div class="item-hr"></div>
        <div class="item">
          <div class="item-title">条件</div>
          <div v-if="formData.type == 1" class="radioA">
            <div style="padding-bottom: 10px;display: flex;justify-content: space-between;">
              <el-button size="mini" class="bottom_all" style="margin-left: 0;" @click="addlist">
                <i class="icon iconfont iconicon_button_add" style="font-size: 12px;"></i>
                添加
              </el-button>
            </div>
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border :data="list" style="width: 100%">
              <el-table-column prop="date" label="值" width="auto" align="center">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.name" placeholder="请输入" clearable></el-input>
                </template>
              </el-table-column>
              <el-table-column prop="name" label="操作" width="75" align="center">
                <template slot-scope="scope">
                  <el-link :underline="false" class="table_link" @click="deletelist(scope.$index)">
                    <i class="icon iconfont iconicon_button_delete" style="font-size: 12px;"></i>
                    删除
                  </el-link>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div v-if="formData.type == 3" class="radio">
            <div class="radio">
              <el-radio-group v-model="symbol">
                <div class="radio-bg">
                  <el-radio label="≥">≥</el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label=">">></el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="≤">≤</el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="＜">&#60;</el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="=">=</el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="≤x,且x≤">≤x,且x≤</el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="<x,且x<">&#60;x,且x&#60;
                  </el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="≤x,且x<">≤x,且x&#60;
                  </el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="<x,且x≤">&#60;x,且x≤
                  </el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="x≤,或x≥">x≤,或x≥</el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="x<,或x>">x&#60;,或x&#62;
                  </el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="±">±
                  </el-radio>
                </div>
                <!-- <div class="radio-bg">
                  <el-radio label="≤x,或x<">≤x,或x&#60;</el-radio>
                </div>
                <div class="radio-bg">
                  <el-radio label="<x,或x≤">&#60;x,或x≤
                  </el-radio>
                </div> -->
              </el-radio-group>
            </div>
          </div>
        </div>
      </div>
    </div>
    <el-dialog v-dialogDrag :visible.sync="projectVisisble" width="300px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">检验项目</span>
      <div>
        <el-form :model="projectForm" :inline="true">
          <el-form-item prop="name">
            <span slot="label">名称</span>
            <el-input v-model="projectForm.name"></el-input>
          </el-form-item>
          <el-form-item prop="sortNum">
            <span slot="label">排序</span>
            <el-input v-model="projectForm.sortNum"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer" style="text-align:center;">
          <el-button class="bottom_all_two" @click="projectVisisble=false">关 闭</el-button>
          <el-button class="bottom_all" style="margin-left: 24px;" @click="addProjectSubmit()">确定</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script src="./set.js"></script>

<style lang="scss" scoped>
.info {
  height: 800px;
  padding: 20px;
}
.item1 {
  border: 1px solid #ffffff;
  height: 40px;
  font-weight: bold;
  color: #000000;
  background: #e1e5ed;
  font-size: 14px;
  display: flex;
  justify-content: space-around;
  > div {
    flex: 1;
    height: 40px;
    @include discen;
  }
  .active {
    flex: 1;
    background: #ffffff;
  }
}
.items {
  display: flex;
  height: calc(100% - 34px);
}
.item {
  flex: 1;
  border: 1px solid rgba(225, 229, 237, 1);
  border-radius: 4px;
  overflow: hidden;
  .item-title {
    color: #000000;
    background: #e1e5ed;
    font-size: 14px;
    @include discen;
    height: 40px;
    font-weight: bold;
  }
}
.radio {
  padding: 20px;
  .radio-bg {
    height: 28px;
  }
}
.item-hr {
  width: 20px;
  height: 20px;
}
.numbertext {
  display: flex;
  align-items: center;
  span {
    padding-right: 15px;
  }
}
.leftitem {
  overflow: auto;
  height: calc(100% - 56px);
}
.radio {
  .el-radio {
    margin-right: 0px;
  }
  padding: 20px;
  .radio-bg {
    width: 100%;
    height: 28px;
    white-space: nowrap;
  }
  i {
    color: #808080;
    margin-left: 5px;
  }
  i:hover {
    color: $bg_color;
  }
}
.radioA {
  padding: 20px;
}
.radio {
  overflow: auto;
  height: calc(100% - 82px);
}
.radio::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}
.radio::-webkit-scrollbar-track {
  background: rgb(239, 239, 239);
  border-radius: 2px;
}
.radio::-webkit-scrollbar-thumb {
  background: #bfbfbf;
  border-radius: 10px;
}
.radio::-webkit-scrollbar-thumb:hover {
  background: $bg_color;
}
.radio::-webkit-scrollbar-corner {
  background: $bg_color;
}
.radio-bg:hover .block {
  display: inline-block;
}
.block {
  display: none;
}
.link_bg {
  padding: 10px 20px;
}
.table_link {
  margin-left: 10px;
  color: $bg_color;
}
.table_link:hover {
  opacity: 0.8;
}
</style>
